package com.atguigu.edustatistics.controller;


import com.atguigu.commonutils.R;
import com.atguigu.edustatistics.client.UcenterClient;
import com.atguigu.edustatistics.service.StatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author jyd
 * @since 2022-04-05
 */
@RestController
//@CrossOrigin
@RequestMapping("/staService/statisticsDaily")
public class StatisticsDailyController {

    @Autowired
    private StatisticsDailyService staService;

    //查询某一天注册的人数
    @PostMapping("registerCount/{day}")
    public R registerCount(@PathVariable String day){
        staService.registerCount(day);
        return R.ok();
    }
    //查询图表所需的数据，包括两部分，日期json数组，数量json数组
    @GetMapping("showData/{type}/{begin}/{end}")
    public R showData(@PathVariable String type,@PathVariable String begin,@PathVariable String end){
        Map<String,Object> map = staService.showData(type,begin,end);
        return R.ok().data(map);
    }

}

